recursionCmp
<template>
    <el-dialog title="递归" v-model="dialogVisible" width="500px">
        <el-main>
            <el-button plain @click="openMyself">打开自身组件</el-button>
        </el-main>

        <template #footer>
            <el-button plain @click="dialogVisible = false">关闭</el-button>
        </template>
    </el-dialog>

    <dialogCmp ref="dialogCmpRef" v-if="dialogVisible"></dialogCmp>
</template>

<script setup>
import { ref, onMounted } from 'vue'

defineOptions({
    name: 'dialogCmp'
})
onMounted(() => {
    console.log('i am coming');
})
const dialogVisible = ref(false)
const open = () => {
    dialogVisible.value = true
}

const dialogCmpRef = ref(null)
const openMyself = () => {
    dialogCmpRef.value.open()
}

defineExpose({ open })
</script>

<style lang="scss" scoped>
</style>